package com.gemme.gemme.view;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.gemme.gemme.MainActivity;
import com.gemme.gemme.R;
import com.gemme.gemme.wode.PhotoMyActivity;
import com.luck.picture.lib.config.PictureMimeType;

public class FaBuDialog {
    BottomDialog dialog;
    private Context mContext;

    public void showDialog(Context mContext){
//new int[]{R.id.close}
        dialog = new BottomDialog(mContext, R.layout.fabu_dialog,
                new int[]{R.id.close,R.id.ll_picture,R.id.ll_video});
        this.mContext = mContext;

        dialog.show();
        initView();
        dialog.setOnBottomItemClickListener(new BottomDialog.OnBottomItemClickListener() {
            @Override
            public void onBottomItemClick(BottomDialog dialog, View view) {
                switch (view.getId()){
                    case R.id.close:
                        dialog.dismiss();
                        //跳转广场页
                        judgeToGuangchang();
                        break;
                    case R.id.ll_picture:
                        Intent intent = new Intent(mContext, PhotoMyActivity.class);
                        intent.putExtra("type", PictureMimeType.ofImage());
                        mContext.startActivity(intent);
                        dialog.dismiss();
                        break;
                    case R.id.ll_video:
                        Intent intent1 = new Intent(mContext, PhotoMyActivity.class);
                        intent1.putExtra("type", PictureMimeType.ofVideo());
                        mContext.startActivity(intent1);
                        dialog.dismiss();
                        break;
                }
            }
        });
    }

    private void judgeToGuangchang() {
        if(mContext instanceof MainActivity){
            MainActivity act = (MainActivity) this.mContext;
            act.toOnResume();
        }

    }

    private void initView() {
        View view = dialog.getView();

    }



}
